home *** CD-ROM | disk | FTP | other *** search
/ LiquidLibrary 2005 September / LiquidLibrary 2005 Sep - Disc 1.iso / pc / Portfolio Browser / Filters / PDF / LIB / gs_epsf.ps < prev    next >
Text File  |  2003-01-03  |  2KB  |  50 lines

  1. %    Copyright (C) 1989, 1996 Aladdin Enterprises.  All rights reserved.
  2. % This software is licensed to a single customer by Artifex Software Inc.
  3. % under the terms of a specific OEM agreement.
  4.  
  5. % $RCSfile$ $Revision$
  6. % Allow the interpreter to recognize MS-DOS EPSF file headers, and skip to
  7. % the PostScript section of the file.
  8.  
  9. /.runnoepsf /run load def
  10. /.epsfheader <C5D0D3C6> def
  11. /run
  12.  { dup type /filetype ne { (r) file } if
  13.         % Check for MS-DOS EPSF file (see Red Book p. 729).
  14.    true exch 0 1 3
  15.     {        % Stack: true file index
  16.       1 index read dup { pop dup .epsfheader 3 index get eq } if
  17.        { pop pop }    % if matched, don't need the character
  18.        {    % unread characters (wasn't EPSF)
  19.      2 index exch unread     % unread mismatch character
  20.      dup {   % loop unreading backwards in .epsfheader
  21.        1 sub dup .epsfheader exch get 2 index exch unread
  22.      } repeat pop
  23.      exch not exch exit    % change true to false
  24.        }
  25.       ifelse
  26.     }
  27.    for exch    % Stack: file true/false
  28.     {        % This block is executed if the file is MS-DOS EPSF.
  29.         % Build up the little-endian byte offset and length.
  30.       2
  31.     { 1 0 4
  32.        { 2 index read not { pop exit } if % if EOF, let error happen
  33.          2 index mul add exch 256 mul exch
  34.        }
  35.       repeat exch pop exch
  36.     }
  37.       repeat
  38.         % Stack: offset length file
  39.         % Use flushfile to skip quickly to the start of the
  40.         % PostScript section.
  41.       dup 4 -1 roll 12 sub () /SubFileDecode filter flushfile
  42.         % Now interpret the PostScript.
  43.       exch () /SubFileDecode filter cvx .runexec
  44.     }
  45.     { .runnoepsf
  46.     }
  47.    ifelse
  48.  } odef
  49.